<?php
require_once dirname(__FILE__).'/../bootstrap/unit.php';

class unit_StringManipulationTest extends sfPHPUnitBaseTestCase
{
  
  /**
   * @author Maximilian Lenkeit <dev@lenki.com>
   * @covers StringManipulation::sluggify
   */
  public function testSluggifyShouldReplaceWhitespacesByDashes() {
    $input = 'String with three whitespaces';
    $this->assertEquals(0, substr_count($input, '-'));
    $output = StringManipulation::sluggify($input);
    $this->assertEquals(3, substr_count($output, '-'));
  }
  
  /**
   * @author Maximilian Lenkeit <dev@lenki.com>
   * @covers StringManipulation::sluggify
   */
  public function testSluggifyShouldReplaceUpperCaseCharactersByLowerCaseEquivalent() {
    $input = 'MyCamelCaseString';
    $exptected = 'mycamelcasestring';
    $this->assertEquals($exptected, StringManipulation::sluggify($input));
  }
}